package com.zhentao.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.zhentao.model.common.dtos.PermissionResult;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.pojo.core.ChargeStationGun;
import com.zhentao.model.pojo.core.ChargeStationInfo;
import com.zhentao.model.pojo.core.dto.ChargeStationInfoDto;
import com.zhentao.service.ChargeStationGunService;
import com.zhentao.service.ChargeStationInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/auth/adminCore")
public class ChargeCoreAdminController {
    @Resource
    ChargeStationInfoService chargeStationInfoService;
    @Resource
    ChargeStationGunService chargeStationGunService;

    /**
     * 充电站查询
     * @param chargeStationInfoDto
     * @return
     * WXQ
     */
  @PostMapping("/AdminChangeList")
    public PermissionResult GetAdminChangeList(@RequestBody ChargeStationInfoDto chargeStationInfoDto){
       return  chargeStationInfoService.GetAdminChangeList(chargeStationInfoDto);
  }

    /**
     * 管理端充电站信息修改
     * @param chargeStationInfoDto
     * @return
     * WXQ
     */
  @PostMapping("/AdminChangeUpdate")
    public PermissionResult AdminChangeUpdate(@RequestBody ChargeStationInfoDto chargeStationInfoDto){
      return chargeStationInfoService.AdminChangeUpdate(chargeStationInfoDto);
  }

    /**
     * 充电站删除
     * @param chargeStationInfoDto
     * @return
     */
  @PostMapping("/AdminChangeDel")
    public PermissionResult AdminChangeDel(@RequestBody ChargeStationInfoDto chargeStationInfoDto){
      return chargeStationInfoService.AdminChangeDel(chargeStationInfoDto);
  }

    /**
     * 查询充电枪
     */
    @PostMapping("/AdminGunAll")
    public PermissionResult AdminGunAll(@RequestBody ChargeStationInfoDto chargeStationInfoDto){
        return chargeStationGunService.getAdminCoreGunList(chargeStationInfoDto);
    }
    /**
     * 充电枪删除操作
     */
    @PostMapping("/AdminGunDel")
    public PermissionResult AdminGunDel(@RequestBody ChargeStationGun chargeStationGun){
        return chargeStationGunService.AdminGunDel(chargeStationGun);
    }
    @PostMapping("/AdminGunUpdate")
    public PermissionResult AdminGunUpdate(@RequestBody ChargeStationGun chargeStationGun){
        return chargeStationGunService.AdminCoreGunUpdate(chargeStationGun);
    }
    @PostMapping("/{id}")
    public ChargeStationInfo AdminFeignInfo(@PathVariable Integer id){
        return chargeStationInfoService.getById(id);
    }

    @PostMapping("/AdminMarkeyCoreAll")
    public List<ChargeStationInfo> AdminMarkeyCoreAll(){
        return chargeStationInfoService.list();
    }
}
